using System;
using GalaSoft.MvvmLight;
using System.Collections.ObjectModel;
using Locator.Silverlight.Client.Models.ViewModels.Elements;
using Locator.Silverlight.Client.Models.InventoryServiceReference;

namespace Locator.Silverlight.Client.Models.ViewModels.Screens
{
    public class ResultDetailsViewModel : ViewModelBase
    {
        public ResultDetailsViewModel()
        {
#if DEBUG
            if (this.IsInDesignMode)
            {
                ObservableCollection<InventoryInfo> invInfo = new ObservableCollection<InventoryInfo>();
                invInfo.Add(new InventoryInfo() { NumberInStock = 33, Product = new ProductListItem() { Id = 33, Name = "Domaine De La Seigneurie Des Tourelles Saumur 2008 750 mL bottle" } });
                invInfo.Add(new InventoryInfo() { NumberInStock = 5600, Product = new ProductListItem() { Id = 56, Name = "Canadian" } });
                for (int i = 0; i < 20; i++)
                {
                    invInfo.Add(new InventoryInfo() { NumberInStock = 5600 + i, Product = new ProductListItem() { Id = i, Name = "Product " + i } });
                }

                StoreWithInventory sWithInv = new StoreWithInventory();
                sWithInv = new StoreWithInventory()
                {
                    Inventory = invInfo,
                    Store = new InvStore()
                    {
                        City = "City 123",
                        Address = "Address 123",
                        Latitude = 43.474249M,
                        Longitude = -79.732728M
                    }
                };

                this.StoreWithInventory = new StoreWithInventoryViewModel(sWithInv);
            }
#endif
        }

        public StoreWithInventoryViewModel StoreWithInventory { get; set; }

        public string Address
        {
            get { return this.StoreWithInventory.Address; }
        }

        public ObservableCollection<InventoryInfoViewModel> InventoryInfo
        {
            get { return this.StoreWithInventory.InventoryInfo; }
        }
    }
}
